<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微服务架构中的并发编程与多线程管理</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
            overflow: hidden;
        }
        
        .hero-gradient::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            bottom: -50%;
            left: -50%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: pulse 15s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(1) rotate(0deg); }
            50% { transform: scale(1.1) rotate(180deg); }
        }
        
        .content-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .content-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 80%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            padding: 20px;
            overflow-x: auto;
            position: relative;
            margin: 20px 0;
        }
        
        .code-block::before {
            content: 'JAVA';
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 12px;
            color: #666;
            font-weight: bold;
        }
        
        .feature-card {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 30px;
            border-radius: 15px;
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
        }
        
        .feature-card::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
            animation: rotate 20s linear infinite;
        }
        
        @keyframes rotate {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .feature-card:hover {
            transform: scale(1.05);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
        }
        
        .drop-cap {
            float: left;
            font-size: 4em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0 0;
            font-weight: 700;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-family: 'Noto Serif SC', serif;
        }
        
        .highlight-box {
            background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
            padding: 20px;
            border-radius: 10px;
            margin: 20px 0;
            position: relative;
            overflow: hidden;
        }
        
        .highlight-box::after {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
            border-radius: 10px;
            z-index: -1;
            opacity: 0.5;
            filter: blur(10px);
        }
        
        .mermaid {
            margin: 30px auto;
            text-align: center;
        }
        
        .icon-feature {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            color: white;
            font-size: 24px;
            margin-bottom: 20px;
            box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
        }
        
        .timeline-item {
            position: relative;
            padding-left: 40px;
            margin-bottom: 30px;
        }
        
        .timeline-item::before {
            content: '';
            position: absolute;
            left: 10px;
            top: 5px;
            width: 10px;
            height: 10px;
            background: #667eea;
            border-radius: 50%;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
        }
        
        .timeline-item::after {
            content: '';
            position: absolute;
            left: 14px;
            top: 15px;
            width: 2px;
            height: calc(100% + 10px);
            background: #e0e0e0;
        }
        
        .timeline-item:last-child::after {
            display: none;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20 px-6 relative">
        <div class="max-w-6xl mx-auto relative z-10">
            <h1 class="text-5xl md:text-6xl font-bold mb-6 leading-tight">
                微服务架构中的<br>
                <span class="text-yellow-300">并发编程</span>与<span class="text-yellow-300">多线程管理</span>
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90 max-w-3xl">
                探索高性能微服务的核心技术，掌握并发编程的艺术，构建可扩展的分布式系统
            </p>
            <div class="flex flex-wrap gap-4">
                <div class="bg-white bg-opacity-20 backdrop-filter backdrop-blur-lg rounded-lg px-6 py-3">
                    <i class="fas fa-microchip mr-2"></i>
                    <span class="font-semibold">高并发处理</span>
                </div>
                <div class="bg-white bg-opacity-20 backdrop-filter backdrop-blur-lg rounded-lg px-6 py-3">
                    <i class="fas fa-network-wired mr-2"></i>
                    <span class="font-semibold">分布式架构</span>
                </div>
                <div class="bg-white bg-opacity-20 backdrop-filter backdrop-blur-lg rounded-lg px-6 py-3">
                    <i class="fas fa-tachometer-alt mr-2"></i>
                    <span class="font-semibold">性能优化</span>
                </div>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-6xl mx-auto px-6 py-12">
        <!-- Introduction -->
        <div class="content-card rounded-2xl p-8 mb-8">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">随</span>着微服务架构的广泛应用，开发者在构建和维护微服务时面临的挑战不断增加。在这些挑战中，如何实现高效的并发编程与多线程管理，成为了保证微服务高性能、低延迟的关键因素之一。
            </p>
        </div>

        <!-- Architecture Overview -->
        <div class="grid md:grid-cols-2 gap-8 mb-12">
            <div class="feature-card">
                <div class="relative z-10">
                    <div class="icon-feature mb-4">
                        <i class="fas fa-cubes"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4">微服务架构</h3>
                    <p class="text-white opacity-90">
                        将单一应用拆解为多个小型、自治服务的架构模式，通过网络互相通信，独立部署、扩展和维护。
                    </p>
                </div>
            </div>
            <div class="feature-card" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">
                <div class="relative z-10">
                    <div class="icon-feature mb-4">
                        <i class="fas fa-sync-alt"></i>
                    </div>
                    <h3 class="text-2xl font-bold mb-4">并发编程</h3>
                    <p class="text-white opacity-90">
                        帮助服务在高并发情况下保持良好的响应能力，避免性能瓶颈，是微服务架构设计的关键。
                    </p>
                </div>
            </div>
        </div>

        <!-- Concept Visualization -->
        <div class="content-card rounded-2xl p-8 mb-8">
            <h2 class="text-3xl font-bold mb-6 text-center text-gray-800">微服务并发架构全景图</h2>
            <div class="mermaid">
                graph TB
                    A[客户端请求] -->|负载均衡| B[API网关]
                    B --> C[服务A]
                    B --> D[服务B]
                    B --> E[服务C]
                    
                    C --> F[线程池]
                    D --> G[线程池]
                    E --> H[线程池]
                    
                    F --> I[数据库]
                    G --> I
                    H --> J[缓存]
                    
                    F --> K[消息队列]
                    G --> K
                    H --> K
                    
                    style A fill:#f9f,stroke:#333,stroke-width:2px
                    style B fill:#bbf,stroke:#333,stroke-width:2px
                    style C fill:#9f9,stroke:#333,stroke-width:2px
                    style D fill:#9f9,stroke:#333,stroke-width:2px
                    style E fill:#9f9,stroke:#333,stroke-width:2px
                    style I fill:#ff9,stroke:#333,stroke-width:2px
                    style J fill:#ff9,stroke:#333,stroke-width:2px
                    style K fill:#f99,stroke:#333,stroke-width:2px
            </div>
        </div>

        <!-- Multi-threading Section -->
        <div class="content-card rounded-2xl p-8 mb-8">
            <h2 class="section-title text-3xl font-bold mb-6 text-gray-800">多线程与并发请求处理</h2>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-xl">
                    <i class="fas fa-layer-group text-3xl text-purple-600 mb-4"></i>
                    <h4 class="text-xl font-semibold mb-2">多线程基础</h4>
                    <p class="text-gray-700">通过在单一进程中同时执行多个线程来实现并发处理，提高程序执行效率。</p>
                </div>
                <div class="bg-gradient-to-br from-blue-50 to-cyan-50 p-6 rounded-xl">
                    <i class="fas fa-server text-3xl text-blue-600 mb-4"></i>
                    <h4 class="text-xl font-semibold mb-2">微服务应用</h4>
                    <p class="text-gray-700">将每个请求分配给独立的线程进行处理，实现并发处理，减少请求等待时间。</p>
                </div>
                <div class="bg-gradient-to-br from-green-50 to-teal-50 p-6 rounded-xl">
                    <i class="fas fa-swimming-pool text-3xl text-green-600 mb-4"></i>
                    <h4 class="text-xl font-semibold mb-2">线程池管理</h4>
                    <p class="text-gray-700">通过复用线程来减少线程创建与销毁的开销，提高系统性能。</p>
                </div>
            </div>

            <div class="code-block">
                <pre><code>ExecutorService executorService = Executors.newFixedThreadPool(10);
executorService.submit(() -> {
    // 处理任务
});</code></pre>
            </div>
        </div>

        